using System;
using Glade;
using Gtk;

namespace DreamPark
{
	public class Screen_RetraitVehicule
	{
		private ControleurEntree ctrlEntree;
		private int acces;
		
		public Screen_RetraitVehicule (ControleurEntree ctrlEntree, int acces)
		{
			Glade.XML gxml = new Glade.XML (null, "DreamPark.FenetreRetraitVehicule.glade", "FenetreRetraitVehicule", null);                    
            gxml.Autoconnect (this);
			
			this.ctrlEntree = ctrlEntree;
			this.acces = acces;
		}
		
		[Glade.Widget]
		Dialog FenetreRetraitVehicule;
		
		[Glade.Widget]
		Entry ZoneEntreeNumeroTicket;
		
		public void BoutonOK_clicked_cb(System.Object obj, EventArgs e){
			string numeroTicket = ZoneEntreeNumeroTicket.Text;
			bool vehiculeSorti = ctrlEntree.SortirVehicule(numeroTicket);
			
			if (vehiculeSorti) {
				Screen_RecuperationVehiculeEnCours fenetreRecuperationEnCours = new Screen_RecuperationVehiculeEnCours(ctrlEntree, acces, numeroTicket);
			} else {
				Screen_TicketNonValide fenetreTicketNonValide = new Screen_TicketNonValide(ctrlEntree, acces);
			}
			FenetreRetraitVehicule.Destroy();
		}
		
		public void BoutonNOK_clicked_cb(System.Object obj, EventArgs e){
			FenetreRetraitVehicule.Destroy();
		}
	}
}

